//
//  UIView+Animation.m
//  BZFoundation
//
//  Created by 郭艺伟 on 2017/9/30.
//  Copyright © 2017年 郭艺伟. All rights reserved.
//

#import "UIView+Animation.h"

@implementation UIView (Animation)
- (void)bz_animateWithFrameBeginValue:(CGRect)beginRect
                           toValue:(CGRect)toRect
                          duration:(CGFloat)duration
                             delay:(NSTimeInterval)delay
                        completion:(void(^)(BOOL finished))completion
{
    self.frame = beginRect;
    [UIView animateWithDuration:duration delay:delay options:UIViewAnimationOptionCurveEaseInOut animations:^{
        self.frame = toRect;
    } completion:completion];
}

- (void)bz_animateWithScaleBeginValue:(CGFloat)beginValue
                           toValue:(CGFloat)toValue
                          duration:(CGFloat)duration
                             delay:(NSTimeInterval)delay
                        completion:(void(^)(BOOL finished))completion
{
    self.transform = CGAffineTransformMakeScale(beginValue, beginValue);
    [UIView animateWithDuration:duration delay:delay options:UIViewAnimationOptionCurveEaseInOut animations:^{
        self.transform = CGAffineTransformMakeScale(toValue, toValue);
    } completion:completion];
}

@end
